<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Get the last error code</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.odbc-do.html">odbc_do</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.odbc-errormsg.html">odbc_errormsg</a></div>
 <div class="up"><a href="ref.uodbc.html">ODBC 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.odbc-error" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">odbc_error</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.5, PHP 5)</p><p class="refpurpose"><span class="refname">odbc_error</span> &mdash; <span class="dc-title">Get the last error code</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.odbc-error-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">string</span> <span class="methodname"><strong>odbc_error</strong></span>
    ([ <span class="methodparam"><span class="type">resource</span> <code class="parameter">$connection_id</code></span>
  ] )</div>

  <p class="simpara">
   Returns a six-digit ODBC state, or an empty string if there has been no
   errors.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.odbc-error-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">connection_id</code></em></dt>

     <dd>

      <p class="para">ODBC 连接标识符，详见
<span class="function"><a href="function.odbc-connect.html" class="function">odbc_connect()</a></span>。</p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.odbc-error-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   If <em><code class="parameter">connection_id</code></em> is specified, the last state
   of that connection is returned, else the last state of any connection
   is returned.
  </p>
  <p class="para">
   This function returns meaningful value only if last odbc query failed
   (i.e. <span class="function"><a href="function.odbc-exec.html" class="function">odbc_exec()</a></span> returned <strong><code>FALSE</code></strong>).
  </p>
 </div>

 <div class="refsect1 seealso" id="refsect1-function.odbc-error-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.odbc-errormsg.html" class="function" rel="rdfs-seeAlso">odbc_errormsg()</a> - Get the last error message</span></li>
    <li class="member"><span class="function"><a href="function.odbc-exec.html" class="function" rel="rdfs-seeAlso">odbc_exec()</a> - Prepare and execute an SQL statement</span></li>
   </ul>
  </p>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.odbc-do.html">odbc_do</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.odbc-errormsg.html">odbc_errormsg</a></div>
 <div class="up"><a href="ref.uodbc.html">ODBC 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
